package com.xiaoyu.lanling.feature.checkin.viewholder

import `in`.srain.cube.views.list.ViewHolderBase
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.facebook.drawee.view.SimpleDraweeView
import com.xiaoyu.lanling.R
import com.xiaoyu.lanling.feature.checkin.datamodel.CheckInDailyItem
import com.xiaoyu.lanling.media.image.ImageViewUtil

class CheckInDailyViewHolder : ViewHolderBase<CheckInDailyItem>() {

    private lateinit var title: TextView
    private lateinit var icon: SimpleDraweeView
    private lateinit var desc: TextView

    override fun createView(layoutInflater: LayoutInflater, parent: ViewGroup): View? {
        val view = layoutInflater.inflate(R.layout.check_in_daily_item, parent, false)
        title = view.findViewById(R.id.title)
        icon = view.findViewById(R.id.icon)
        desc = view.findViewById(R.id.desc)
        return view
    }

    override fun showData(position: Int, itemData: CheckInDailyItem) {
        title.text = itemData.title
        ImageViewUtil.loadImage(icon, itemData.imageLayoutParams)
        desc.text = itemData.statusDesc
        mCurrentView.isSelected = itemData.selected
    }
}